﻿<%@ Page EnableEventValidation="false" Language="C#" AutoEventWireup="true" Inherits="cp_member_history" Codebehind="history.aspx.cs" %>
<%@ Register TagPrefix="obout" Namespace="Obout.Grid" Assembly="obout_Grid_NET" %>
<%@ Register TagPrefix="owd" Namespace="OboutInc.Window" Assembly="obout_Window_NET"%>
<%@ Register TagPrefix="osb" Namespace="OboutInc.OboutSuperButton" Assembly="obout_SuperButton" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" src="/JavaScripts/jquery-1.3.2.js">
    </script>
    <script type="text/javascript">
        $("document").ready(function() {
            $("#btnOpenEditField").bind("click", function() {
                $("#div1").toggle("fast");
                });
            });
    </script>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">

        <obout:Grid runat="server" ID="grid1" AutoGenerateColumns="false"
		    FolderStyle="/App_Themes/E2GroupTheme/obout/styles/style_4" 
		    AllowAddingRecords="false" 
		    AllowColumnResizing = "true"
		    AllowRecordSelection = "false"
		    AllowSorting = "true"
		    Width = "1000"
		    >
            <Columns>
                <obout:Column DataField="NgayDatHang" HeaderText="Ngày đặt hàng" DataFormatString = "{0:dd/MM/yyyy}" Width = "120" Wrap = "true"  Align="center"></obout:Column>
                <obout:Column DataField="TenNguoiNhan" HeaderText="Tên người nhận" 
                    Width = "125" Wrap = "true" Align="center"></obout:Column>
                <obout:Column DataField="DiaChiNguoiNhan" HeaderText="Địa chỉ người nhận:" Width = "160" Wrap = "true" Align="center"></obout:Column>
                <obout:Column DataField="SDTNguoiNhan" HeaderText="Số điện thoại người nhận" Width = "125" Wrap = "true" Align="center"></obout:Column>
                <obout:Column DataField="PhuongThucThanhToan" HeaderText="PT thanh toán" Width = "115" Wrap = "true" Align="center"></obout:Column>
                <obout:Column DataField="PhuongThucGiaoHang" HeaderText="PT giao hàng" Width = "115" Wrap = "true" Align="center"></obout:Column>
                <obout:Column DataField="TongTien" HeaderText="Tổng tiền" Width = "120" Wrap = "true" Align="center">
                    <TemplateSettings TemplateId="GiaTienTemplate" />
                </obout:Column>
            </Columns>
            
            <Templates>
                <obout:GridTemplate runat="server" ID="DeleteTemplate">
                    <Template>
                        <a href="javascript:" style="outline:none">
                            <img id="imgDeleteBasket" src="/images/Button/Delete.png" alt="" onclick='grid1.delete_record(this);' width="50" height="25" style="border-style: none"/>
                        </a>
                    </Template>
                </obout:GridTemplate>
                
                <obout:GridTemplate runat="server" ID="GiaTienTemplate">
	                <Template>
	                    <%# E2_WEBSITE.Code.Utilities.ConvertToMoneyFormat(int.Parse(Container.Value.ToString()), true)%>
	                </Template>
                </obout:GridTemplate>
            </Templates>
            <MasterDetailSettings LoadingMode="OnCallback" />
            <ScrollingSettings ScrollHeight="520" ScrollWidth = "510"/>
            <DetailGrids>
                <obout:DetailGrid runat="server" ID="grid2" AutoGenerateColumns="false" 
                 AllowAddingRecords="false" ShowFooter="true" AllowPageSizeSelection="false" AllowPaging="false"
                 DataSourceID="dsLevel2" FolderStyle="/App_Themes/E2GroupTheme/obout/styles/black_glass" 
                 ForeignKeys="idHoaDon" AllowColumnResizing = "true" AllowRecordSelection = "false"
                 AllowSorting = "false">
                    <Columns>
                        <obout:Column DataField="TenSanPham" HeaderText="Tên sản phẩm" Width = "125" Wrap="true" Align="center"></obout:Column>
                        <obout:Column DataField="Url" HeaderText="Hình ảnh" Width="100" Align="center" Wrap = "true">
                            <TemplateSettings TemplateID="ImageTemplate" />
                        </obout:Column>
                        <obout:Column DataField="MauSac" HeaderText="Màu sắc" Width = "90" Wrap ="true" Align="center"></obout:Column>
                        <obout:Column DataField="SoLuong" HeaderText="Số lượng" Width = "90" Wrap ="true" Align="center"></obout:Column>
                        <obout:Column DataField="DonGia" HeaderText="Đơn giá" Width="120" Wrap = "true" Align="center">
                            <TemplateSettings TemplateId="GiaTienTemplate1" />
                        </obout:Column>
                        
                        <obout:Column DataField="ThanhTien" HeaderText="Thành tiền" Width="120" Wrap = "true" Align="center">
                            <TemplateSettings TemplateId="GiaTienTemplate1" />
                        </obout:Column>
                    </Columns>
                    
                    <Templates>
				        <obout:GridTemplate runat="server" ID="ImageTemplate">
					        <Template>
					            <a href = "javascript:parent.location.href='/Products/detail.aspx?ProductId=<%# Container.DataItem["idSanPham"]%>';" style="outline:none">
					            <img src="/images/HinhAnhSanPham/<%# Container.DataItem["Url"] %>" alt="" width="50" height="50" border="0" />
			                    </a>
			                </Template>
				        </obout:GridTemplate>
				        <obout:GridTemplate runat="server" ID="GiaTienTemplate1">
	                        <Template>
	                            <%# E2_WEBSITE.Code.Utilities.ConvertToMoneyFormat(int.Parse(Container.Value.ToString()), true)%>
	                        </Template>
                        </obout:GridTemplate>
			        </Templates>
			        
                    <MasterDetailSettings LoadingMode="OnCallback" />
                    <DetailGrids>
                    </DetailGrids>
                 </obout:DetailGrid>
            </DetailGrids>
        </obout:Grid>
        

    <asp:SqlDataSource ID="dsLevel2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
        SelectCommand="select cthd.idSanPham, SoLuong, DonGia, TenSanPham, MauSac, Url, SoLuong*DonGia as ThanhTien
                        from CHI_TIET_HOA_DON cthd join 
                                ( SAN_PHAM sp join HINH_ANH ha
                                    on sp.id = ha.idSanPham )
                             on cthd.idSanPham = sp.id
                        where idHoaDon = @idHoaDon">
        <SelectParameters>
            <asp:Parameter Name="idHoaDon" Type="Int16" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    </form>
    
</body>
</html>